# -*- encoding: utf-8 -*-
'''
@File		:	matter.media.py
@Time		:	2024/09/03 10:19:02
@Author		:	dan
@Description:	使用socket测试并发
'''

if __name__ == '__main__':
    import sys
    sys.path.append(".")
import matter
import matter.socket
import json


@matter.test_case(name='发送注册')
def test_send():
    # 发送注册
    groupName = matter.env("groupName")
    id = str(matter.random_int(10, 8000));
    reg = {
        "head":"gonsin",
        "device": {
            "id": id
        },
        "cmd": {
            "cmd": "reg",
            "respone": 0
        },
        "args": {
            "group_name": groupName,
            "sender": False
        }
    }
    reg = json.dumps(reg)
    matter.socket.write(reg);



@matter.test_case(name='等待1小时', dependencies="发送注册")
def connection_wait():
    matter.sleep(60 * 60);



if __name__ == '__main__':
    matter.start(yml='demo/matter/socket/media.yml')